cmake_minimum_required(VERSION 3.5) # CMake install :
                                    # https://cmake.org/download/

set(CMAKE_PREFIX_PATH "C:/Qt/5.15.2/msvc2019_64")
set(CMAKE_TOOLCHAIN_FILE "E:/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")

set(CMAKE_INCLUDE_CURRENT_DIR ON)

project(
  QQ
  VERSION 0.1
  LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Core Gui Network Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core Gui Network
                                                       Sql)

find_package(libzip CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(spdlog CONFIG REQUIRED)

include_directories()

include_directories("E:/mcpkg/Agora/include" "E:/mcpkg/vlc/include"
                    "E:/mcpkg/QxOrm/include" "E:/mcpkg/ElaWidgetTools/include")
include_directories("Source")

link_directories("E:/mcpkg/Agora/lib" "E:/mcpkg/vlc/lib"
                 "E:/mcpkg/QxOrm/debug/lib" "E:/mcpkg/ElaWidgetTools/debug/lib")

file(GLOB_RECURSE "INCLUDE" Source/*.h)
qt_wrap_cpp(MOC ${INCLUDE})

file(GLOB_RECURSE ORIGIN  Source/*.cpp)

add_executable(
  ${PROJECT_NAME} WIN32 ${MOC} ${ORIGIN})

target_link_libraries(
  ${PROJECT_NAME}
  PUBLIC Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core
         Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Network
         Qt${QT_VERSION_MAJOR}::Sql  libzip::zip OpenSSL::SSL OpenSSL::Crypto spdlog::spdlog
         ElaWidgetTools${QT_VERSION_MAJOR}d QxOrm${QT_VERSION_MAJOR}d
         libvlc libvlccore "agora_rtc_sdk.dll.lib")
